import { ValidateFieldsError } from 'async-validator';
import { ElNotification } from 'element-plus';

/**
 * 字段未填提示
 * @param fields 未填字段校验信息
 */
export default function errorNotice(fields?: ValidateFieldsError) {
  let msg = '';
  Object.keys(fields as object).forEach((key) => {
    if (fields) {
      msg += `${fields[key][0].message}</br>`;
    }
  });
  ElNotification.warning({
    title: '警告',
    dangerouslyUseHTMLString: true,
    message: msg,
  });
}
